package com.itheima.flowcontrol.demo;

/**
 * 找素数 101-200之间
 */
public class Test4 {
    public static void main(String[] args) {
        int count = 0;
        //for循环 遍历 101-200
        for ( int i = 101; i <= 200; i++){
            if(suShu(i)){
                System.out.print(i + " ");
                count++;
                if (count % 5 == 0){
                    System.out.println();
                }

            }
        }
        System.out.println("素数的个数为：" + count);
    }

    public static boolean suShu(int i) {
        for (int j = 2; j < i / 2 ; j++){
            if(i % j == 0){
                return false;
            }
        }
        return true;

    }
}
